Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Conversation

DominikAdamski
Copy link
Contributor

@DominikAdamski DominikAdamski commented Aug 22, 2023

This MR provides patches for compilation of simple parallel OpenMP Fortran kernel:

program main
   use omp_lib
   integer :: e(256)
   integer :: i
   integer :: d
   !$omp target parallel do map(tofrom: e)
   do i = 1, 256
        e(i) = i + 2
   end do
        !$omp end target parallel do
   print *,"parallel array"
   print *, e

   !$omp target parallel map(from: d)
         d = omp_get_num_threads()
    !$omp end target parallel
   print *,"parallel"
   print *, d
   !$omp target  map(from: d)
         d = omp_get_num_threads()
    !$omp end target
   print *,"generic"
   print *, d

   print *,"passed"
end program main

Known limitations:

  1. Parallel region has to cover target region. If target region contains code which is not covered by parallel pragma then execution mode isn't correctly set up.
  2. Allocas which are used only inside loop body regions are not moved to loop body. This problem should be fixed on MLIR level.
  3. The CodeExtractor contains hardcoded allocation space for struct arguments
  4. No support for additional parallel clauses (like num_threads, etc.) for offloaded code.
  5. Skipped compilation of the new device RTL function for target teams distribute pragma

DominikAdamski and others added 9 commits August 22, 2023 03:33
This patch adds initial support for detecting type of launched kernel.

If there is a parallel pragma inside target region, then we assume
that we have SPMD kernel.

This assumption is not valid for target regions for which parallel region
does not cover the whole target region.
Proposed implementation of the new device OpenMP functions relies on
internal functions which are not used in current version of the OpenMP
runtime.
TODO: Modify CodeExtractor so that it will take alloca address
space from constructor parameter
TODO: Add missing definitions for the newwq OpenMP device RTL functions
TODO: Add missing attributes for the new OpenMP device RTL functions
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant